# arc operations.
set.arc(x, from, to, check.cycles = TRUE, debug = FALSE)
drop.arc(x, from, to, debug = FALSE)
reverse.arc(x, from, to, check.cycles = TRUE, debug = FALSE)# edge (i.e. undirected arc) operations
set.edge(x, from, to, check.cycles = TRUE, debug = FALSE)
drop.edge(x, from, to, debug = FALSE)
bn.TRUE the graph is tested for
acyclicity; otherwise the graph is returned anyway.TRUE a lot of debugging output is
printed; otherwise the function is completely silent.x.set.arc function operates in the following way:
fromandto, the arcfrom$\rightarrow$tois added.fromandto, its
direction is set tofrom$\rightarrow$to.to$\rightarrow$fromis present,
it is reversed.from$\rightarrow$tois present, no
action is taken. The drop.arc function operates in the following way:
fromandto, no action is
taken.fromandto, it is dropped regardless of its direction. The reverse.arc function operates in the following way:
fromandto, it returns an
error.fromandto, it
returns an error.to$\rightarrow$fromis present, it
is reversed.from$\rightarrow$tois present, it
is reversed. The set.edge function operates in the following way:
fromandto, the undirected
arcfrom-tois added.fromandto, no
action is taken.from$\rightarrow$toor the
arcto$\rightarrow$fromare present, they are
replaced with the undirected arcfrom-to. The drop.edge function operates in the following way:
fromandto, no
action is taken.fromandto, it
is removed.fromandto, no
action is taken.data(learning.test)
res = gs(learning.test)
## use debug = TRUE to get more information.
set.arc(res, "A", "B")
drop.arc(res, "A", "B")
drop.edge(res, "A", "B")
reverse.arc(res, "A", "D")Run the code above in your browser using DataLab